package net.huashitong.ssydt.provider.comment.vo;

import io.swagger.annotations.ApiModelProperty;
import net.huashitong.comment.vo.HstComment;

import java.io.Serializable;
import java.util.Date;

/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.09.20
 */
public class CommentVO implements Serializable {

    private static final long serialVersionUID = -7785954783510932733L;
    @ApiModelProperty("评论Id")
    private Long id;
    @ApiModelProperty("评论时间")
    private Date gmtCreate;
    @ApiModelProperty("评论用户信息")
    private User user;//用户id
    @ApiModelProperty("评论内容")
    private String content;//评论内容
    @ApiModelProperty("被引用评论信息")
    private QuoteComment quoteComment;//评论id
    @ApiModelProperty("作者回复")
    private String authorReply;//作者回复
    @ApiModelProperty("点赞数")
    private Integer praiseNumber;//点赞数
    @ApiModelProperty("关联类型（01 文章）")
    private String relationType;//关联类型
    @ApiModelProperty("关联id")
    private Long relationId;//关联id
    @ApiModelProperty("是否点赞")
    private boolean praise = false;//是否点赞

    public CommentVO(HstComment hstComment, User user) {
        this.id = hstComment.getId();
        this.gmtCreate = hstComment.getGmtCreate();
        this.user = user;
        this.content = hstComment.getContent();
        this.authorReply = hstComment.getAuthorReply();
        this.praiseNumber = hstComment.getPraiseNumber();
        this.relationType = hstComment.getRelationType();
        this.relationId = Long.parseLong(hstComment.getRelationId());
    }

    public CommentVO() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public QuoteComment getQuoteComment() {
        return quoteComment;
    }

    public void setQuoteComment(QuoteComment quoteComment) {
        this.quoteComment = quoteComment;
    }

    public String getAuthorReply() {
        return authorReply;
    }

    public void setAuthorReply(String authorReply) {
        this.authorReply = authorReply;
    }

    public Integer getPraiseNumber() {
        return praiseNumber;
    }

    public void setPraiseNumber(Integer praiseNumber) {
        this.praiseNumber = praiseNumber;
    }

    public String getRelationType() {
        return relationType;
    }

    public void setRelationType(String relationType) {
        this.relationType = relationType;
    }

    public Long getRelationId() {
        return relationId;
    }

    public void setRelationId(Long relationId) {
        this.relationId = relationId;
    }

    public boolean isPraise() {
        return praise;
    }

    public void setPraise(boolean praise) {
        this.praise = praise;
    }

    /**
     * 用户对象
     */
    public static class User implements Serializable {

        private static final long serialVersionUID = 6837875890521545199L;
        @ApiModelProperty("用户id")
        private String userId;
        @ApiModelProperty("用户头像")
        private String imageUrl;
        @ApiModelProperty("用户昵称")
        private String nickname;

        public String getUserId() {
            return userId;
        }

        public void setUserId(String userId) {
            this.userId = userId;
        }

        public String getImageUrl() {
            return imageUrl;
        }

        public void setImageUrl(String imageUrl) {
            this.imageUrl = imageUrl;
        }

        public String getNickname() {
            return nickname;
        }

        public void setNickname(String nickname) {
            this.nickname = nickname;
        }
    }

    public static class QuoteComment implements Serializable {

        private static final long serialVersionUID = 6315730749970173905L;
        @ApiModelProperty("评论id")
        private Long id;
        @ApiModelProperty("评论时间")
        private Date gmtCreate;
        @ApiModelProperty("被引用用户信息")
        private User user;//用户id
        @ApiModelProperty("评论内容")
        private String content;//评论内容
        @ApiModelProperty("点赞数")
        private Integer praiseNumber;//点赞数

        public QuoteComment(HstComment hstComment, User user) {
            this.id = hstComment.getId();
            this.gmtCreate = hstComment.getGmtCreate();
            this.user = user;
            this.content = hstComment.getContent();
            this.praiseNumber = hstComment.getPraiseNumber();
        }

        public QuoteComment() {
        }

        public Long getId() {
            return id;
        }

        public void setId(Long id) {
            this.id = id;
        }

        public Date getGmtCreate() {
            return gmtCreate;
        }

        public void setGmtCreate(Date gmtCreate) {
            this.gmtCreate = gmtCreate;
        }

        public User getUser() {
            return user;
        }

        public void setUser(User user) {
            this.user = user;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public Integer getPraiseNumber() {
            return praiseNumber;
        }

        public void setPraiseNumber(Integer praiseNumber) {
            this.praiseNumber = praiseNumber;
        }
    }
}
